add printDocumentAdapter Signed-off-by:lizhixiong12@huawei.com

Signed-off-by: lzzxxxx <lizhixiong12@huawei.com>
This commit is contained in:
lzzxxxx 2023-08-30 10:22:37 +08:00
parent af0f8e9003
commit ab168500be
9 changed files with 38 additions and 23 deletions

View File

@ -112,4 +112,4 @@ private:
std::string option_;
};
} // namespace OHOS::Print
#endif //PRINT_FWK_PRINT_ATTRIBUTES_H
#endif // PRINT_FWK_PRINT_ATTRIBUTES_H

View File

@ -13,7 +13,6 @@
* limitations under the License.
*/
#include <map>
#include "napi/native_api.h"
#include "print_attributes_helper.h"
@ -35,7 +34,7 @@ napi_value PrintAttributesHelper::MakeJsObject(napi_env env, const PrintAttribut
NapiPrintUtils::SetUint32Property(env, jsObj, PARAM_JOB_COPYNUMBER, attributes.GetCopyNumber());
if (!CreatePageRange(env, jsObj, attributes)) {
PRINT_HILOGE("Failed to create page range of print job");
PRINT_HILOGE("Failed to create page range property of print job");
return nullptr;
}
@ -51,7 +50,7 @@ napi_value PrintAttributesHelper::MakeJsObject(napi_env env, const PrintAttribut
NapiPrintUtils::SetUint32Property(env, jsObj, PARAM_JOB_DUPLEXMODE, attributes.GetDuplexMode());
if (!CreateMargin(env, jsObj, attributes)) {
PRINT_HILOGE("Failed to create page margin property of print job");
PRINT_HILOGE("Failed to create margin property of print job");
return nullptr;
}

View File

@ -22,7 +22,6 @@
namespace OHOS::Print {
class PrintDocumentAdapter {
public:
virtual void onStartLayoutWrite(const std::string &jobId, const PrintAttributes &oldAttrs,
const PrintAttributes &newAttrs,
@ -32,5 +31,4 @@ public:
virtual void onJobStateChanged(const std::string &jobId, uint32_t state);
};
}
#endif //PRINT_FWK_IPRINT_ADAPTER_H
#endif // PRINT_FWK_IPRINT_ADAPTER_H

View File

@ -30,4 +30,4 @@ public:
};
}
#endif //PRINT_FWK_IPRINT_INNER_ADAPTER_H
#endif // PRINT_FWK_IPRINT_INNER_ADAPTER_H

View File

@ -1,14 +1,24 @@
//
// Created by h00660855 on 2023/7/18
//
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "iprint_adapter.h"
namespace OHOS::Print {
void PrintDocumentAdapter::onStartLayoutWrite(const std::string &jobId, const PrintAttributes &oldAttrs,
const PrintAttributes &newAttrs, uint32_t fd,
std::function<void(std::string, uint32_t)> writeResultCallback)
const PrintAttributes &newAttrs, uint32_t fd,
std::function<void(std::string, uint32_t)> writeResultCallback)
{
}

View File

@ -1,12 +1,22 @@
//
// Created by h00660855 on 2023/7/18
//
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "iprint_adapter_inner.h"
#include "print_constant.h"
namespace OHOS::Print {
void PrintDocumentInnerAdapter::onStartLayoutWrite(const std::string &jobId, const PrintAttributes &oldAttrs,
const PrintAttributes &newAttrs, uint32_t fd,
std::function<void(std::string, uint32_t)> writeResultCallback)

View File

@ -373,5 +373,4 @@ bool PrintCallback::onCallbackAdapterJobStateChanged(const std::string jobId, co
}, PrintAdapterJobStateChangedAfterCallFun);
}
}
} // namespace OHOS::Print

View File

@ -151,5 +151,4 @@ bool PrintCallbackProxy::onCallbackAdapterJobStateChanged(const std::string jobI
PRINT_HILOGI("PrintCallbackProxy::onCallbackAdapterJobStateChanged End");
return true;
}
} // namespace OHOS::Print

View File

@ -95,7 +95,7 @@ enum PrintJobState {
PRINT_JOB_RUNNING = 2, // executing print job
PRINT_JOB_BLOCKED = 3, // print job has been blocked
PRINT_JOB_COMPLETED = 4, // print job ocmpleted
PRINT_JOB_CREATE_FILE_COMPLETED =5, // create print file completed
PRINT_JOB_CREATE_FILE_COMPLETED = 5, // create print file completed
PRINT_JOB_UNKNOWN = 100, // unknown state of print job
};
@ -128,8 +128,8 @@ enum PrintJobSubState {
PRINT_JOB_BLOCKED_FILE_CONVERT_SLOWLY = 25, // The file conversion is too slow.
PRINT_JOB_RUNNING_UPLOADING_FILES = 26, // Uploading file...
PRINT_JOB_RUNNING_CONVERTING_FILES = 27, // Converting files...
PRINT_JOB_CREATE_FILE_COMPLETED_SUCCESS = 28, //print job create file succeed
PRINT_JOB_CREATE_FILE_COMPLETED_FAILED = 29, //print job create file fail
PRINT_JOB_CREATE_FILE_COMPLETED_SUCCESS = 28, // print job create file succeed
PRINT_JOB_CREATE_FILE_COMPLETED_FAILED = 29, // print job create file fail
PRINT_JOB_BLOCKED_UNKNOWN = 99, // unknown issue
};