1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 17 #ifndef PRINT_FWK_PRINT_ATTRIBUTES_H 18 #define PRINT_FWK_PRINT_ATTRIBUTES_H 19 #define TDD_ENABLE 1 20 21 #include <map> 22 23 #include "iremote_broker.h" 24 #include "iremote_proxy.h" 25 #include "parcel.h" 26 #include "print_margin.h" 27 #include "print_page_size.h" 28 #include "print_preview_attribute.h" 29 #include "print_range.h" 30 31 namespace OHOS::Print { 32 class PrintAttributes final : public Parcelable { 33 public: 34 explicit PrintAttributes(); 35 36 PrintAttributes(const PrintAttributes &right); 37 38 PrintAttributes &operator=(const PrintAttributes &right); 39 40 virtual ~PrintAttributes(); 41 42 void SetCopyNumber(uint32_t copyNumber); 43 44 void SetPageRange(const PrintRange &pageRange); 45 46 void SetIsSequential(bool isSequential); 47 48 void SetPageSize(const PrintPageSize &pageSize); 49 50 void SetIsLandscape(bool isLandscape); 51 52 void SetDirectionMode(uint32_t directionMode); 53 54 void SetColorMode(uint32_t colorMode); 55 56 void SetDuplexMode(uint32_t duplexmode); 57 58 void SetMargin(const PrintMargin &margin); 59 60 void SetOption(const std::string &option); 61 62 void UpdateParams(const PrintAttributes& jobInfo); 63 64 [[nodiscard]] uint32_t GetCopyNumber() const; 65 66 void GetPageRange(PrintRange &range) const; 67 68 [[nodiscard]] bool GetIsSequential() const; 69 70 void GetPageSize(PrintPageSize &printPageSize) const; 71 72 [[nodiscard]] bool GetIsLandscape() const; 73 74 [[nodiscard]] uint32_t GetDirectionMode() const; 75 76 [[nodiscard]] uint32_t GetColorMode() const; 77 78 [[nodiscard]] uint32_t GetDuplexMode() const; 79 80 void GetMargin(PrintMargin &printMargin) const; 81 82 [[nodiscard]] bool HasPreview() const; 83 84 void GetPreview(PrintPreviewAttribute &previewAttr) const; 85 86 [[nodiscard]] bool HasCopyNumber() const; 87 88 [[nodiscard]] bool HasPageRange() const; 89 90 [[nodiscard]] bool HasSequential() const; 91 92 [[nodiscard]] bool HasPageSize() const; 93 94 [[nodiscard]] bool HasLandscape() const; 95 96 [[nodiscard]] bool HasDirectionMode() const; 97 98 [[nodiscard]] bool HasColorMode() const; 99 100 [[nodiscard]] bool HasDuplexMode() const; 101 102 [[nodiscard]] bool HasMargin() const; 103 104 [[nodiscard]] bool HasOption() const; 105 106 [[nodiscard]] const std::string &GetOption() const; 107 108 virtual bool Marshalling(Parcel &parcel) const override; 109 110 virtual bool MarshallingParam(Parcel &parcel) const; 111 112 static std::shared_ptr<PrintAttributes> Unmarshalling(Parcel &parcel); 113 114 void Dump(); 115 116 #ifndef TDD_ENABLE 117 private: 118 #endif 119 bool ReadFromParcel(Parcel &parcel); 120 bool ReadNextDataFromParcel(Parcel &parcel); 121 122 #ifndef TDD_ENABLE 123 private: 124 #endif 125 bool hasCopyNumber_; 126 uint32_t copyNumber_; 127 bool hasPageRange_; 128 PrintRange pageRange_; 129 bool hasSequential_; 130 bool isSequential_; 131 bool hasPageSize_; 132 PrintPageSize pageSize_; 133 bool hasLandscape_; 134 bool isLandscape_; 135 bool hasDirectionMode_; 136 uint32_t directionMode_; 137 bool hasColorMode_; 138 uint32_t colorMode_; 139 bool hasDuplexMode_; 140 uint32_t duplexMode_; 141 bool hasMargin_; 142 PrintMargin margin_; 143 bool hasOption_; 144 std::string option_; 145 }; 146 } // namespace OHOS::Print 147 #endif // PRINT_FWK_PRINT_ATTRIBUTES_H 148