diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-08-17 17:28:58 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-08-18 12:18:34 +0200 |
commit | be3b1a8393ca3e77f31bea5d9caa7271fd53e9e4 (patch) | |
tree | ee82b947c5b3ba648a664dbc5b4be662ce84906c /svtools | |
parent | f1a458a508cd300117338f9005bff82a923c4a60 (diff) |
weld OAppDetailPageHelper
Change-Id: I0fa9f21c30bba8f781178b0811f3f7d755af1bb3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100627
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/Library_svt.mk | 2 | ||||
-rw-r--r-- | svtools/inc/templwin.hrc | 56 | ||||
-rw-r--r-- | svtools/source/contnr/DocumentInfoPreview.cxx | 159 | ||||
-rw-r--r-- | svtools/source/contnr/templwin.cxx | 38 | ||||
-rw-r--r-- | svtools/source/contnr/templwin.hxx | 29 |
5 files changed, 0 insertions, 284 deletions
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 5072c5917592..f094f0ed0cd2 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -88,9 +88,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/config/slidesorterbaropt \ svtools/source/config/optionsdrawinglayer \ svtools/source/config/printoptions \ - svtools/source/contnr/DocumentInfoPreview \ svtools/source/contnr/querydelete \ - svtools/source/contnr/templwin \ svtools/source/control/accessibleruler \ svtools/source/control/asynclink \ svtools/source/control/collatorres \ diff --git a/svtools/inc/templwin.hrc b/svtools/inc/templwin.hrc deleted file mode 100644 index 0147a694ff5b..000000000000 --- a/svtools/inc/templwin.hrc +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you 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 . - */ - -#pragma once - -#include <utility> - -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) - -#define DI_TITLE 1 -#define DI_FROM 2 -#define DI_DATE 3 -#define DI_KEYWORDS 4 -#define DI_DESCRIPTION 5 -#define DI_MIMETYPE 6 -#define DI_MODIFIEDDATE 7 -#define DI_MODIFIEDBY 8 -#define DI_PRINTDATE 9 -#define DI_PRINTBY 10 -#define DI_THEME 11 -#define DI_SIZE 12 - -const std::pair<const char*, int> STRARY_SVT_DOCINFO[] = -{ - { NC_("STRARY_SVT_DOCINFO", "Title") , DI_TITLE }, - { NC_("STRARY_SVT_DOCINFO", "By") , DI_FROM }, - { NC_("STRARY_SVT_DOCINFO", "Date") , DI_DATE }, - { NC_("STRARY_SVT_DOCINFO", "Keywords") , DI_KEYWORDS }, - { NC_("STRARY_SVT_DOCINFO", "Description") , DI_DESCRIPTION }, - { NC_("STRARY_SVT_DOCINFO", "Type") , DI_MIMETYPE }, - { NC_("STRARY_SVT_DOCINFO", "Modified on") , DI_MODIFIEDDATE }, - { NC_("STRARY_SVT_DOCINFO", "Modified by") , DI_MODIFIEDBY }, - { NC_("STRARY_SVT_DOCINFO", "Printed on") , DI_PRINTDATE }, - { NC_("STRARY_SVT_DOCINFO", "Printed by") , DI_PRINTBY }, - { NC_("STRARY_SVT_DOCINFO", "Subject") , DI_THEME }, - { NC_("STRARY_SVT_DOCINFO", "Size") , DI_SIZE } -}; - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/DocumentInfoPreview.cxx b/svtools/source/contnr/DocumentInfoPreview.cxx deleted file mode 100644 index 93b8b27e5790..000000000000 --- a/svtools/source/contnr/DocumentInfoPreview.cxx +++ /dev/null @@ -1,159 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you 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 . - */ - -#include <sal/config.h> - -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/document/XDocumentProperties.hpp> -#include <com/sun/star/script/CannotConvertException.hpp> -#include <com/sun/star/script/Converter.hpp> -#include <com/sun/star/script/XTypeConverter.hpp> -#include <comphelper/processfactory.hxx> -#include <comphelper/string.hxx> -#include <rtl/ustring.hxx> -#include <svtools/DocumentInfoPreview.hxx> -#include <svmedit2.hxx> -#include <vcl/txtattr.hxx> -#include <vcl/settings.hxx> -#include <vcl/svapp.hxx> -#include <tools/datetime.hxx> -#include <tools/diagnose_ex.h> -#include <unotools/localedatawrapper.hxx> - -#include <templwin.hrc> -#include "templwin.hxx" - -namespace svtools { - -ODocumentInfoPreview::ODocumentInfoPreview(vcl::Window * pParent, WinBits nBits) - : Window(pParent, WB_DIALOGCONTROL) - , m_pEditWin( VclPtr<ExtMultiLineEdit>::Create(this, nBits) ) -{ - m_pEditWin->SetLeftMargin(10); - m_pEditWin->Show(); - m_pEditWin->EnableCursor(false); -} - -ODocumentInfoPreview::~ODocumentInfoPreview() -{ - disposeOnce(); -} - -void ODocumentInfoPreview::dispose() -{ - m_pEditWin.disposeAndClear(); - Window::dispose(); -} - -void ODocumentInfoPreview::Resize() { - m_pEditWin->SetPosSizePixel(Point(0, 0), GetOutputSize()); -} - -void ODocumentInfoPreview::clear() { - m_pEditWin->SetText(OUString()); -} - -void ODocumentInfoPreview::fill( - css::uno::Reference< css::document::XDocumentProperties > const & xDocProps) -{ - assert(xDocProps.is()); - - m_pEditWin->SetAutoScroll(false); - - insertNonempty(DI_TITLE, xDocProps->getTitle()); - insertNonempty(DI_FROM, xDocProps->getAuthor()); - insertDateTime(DI_DATE, xDocProps->getCreationDate()); - insertNonempty(DI_MODIFIEDBY, xDocProps->getModifiedBy()); - insertDateTime(DI_MODIFIEDDATE, xDocProps->getModificationDate()); - insertNonempty(DI_PRINTBY, xDocProps->getPrintedBy()); - insertDateTime(DI_PRINTDATE, xDocProps->getPrintDate()); - insertNonempty(DI_THEME, xDocProps->getSubject()); - insertNonempty( - DI_KEYWORDS, - comphelper::string::convertCommaSeparated(xDocProps->getKeywords())); - insertNonempty(DI_DESCRIPTION, xDocProps->getDescription()); - - // User-defined (custom) properties: - css::uno::Reference< css::beans::XPropertySet > user( - xDocProps->getUserDefinedProperties(), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::beans::XPropertySetInfo > info( - user->getPropertySetInfo()); - const css::uno::Sequence< css::beans::Property > props(info->getProperties()); - for (const auto& rProp : props) { - OUString name(rProp.Name); - css::uno::Any aAny(user->getPropertyValue(name)); - css::uno::Reference< css::script::XTypeConverter > conv( - css::script::Converter::create( - comphelper::getProcessComponentContext())); - OUString value; - try { - value = conv->convertToSimpleType(aAny, css::uno::TypeClass_STRING). - get< OUString >(); - } catch (css::script::CannotConvertException &) { - TOOLS_INFO_EXCEPTION("svtools.contnr", "ignored"); - } - if (!value.isEmpty()) { - insertEntry(name, value); - } - } - - m_pEditWin->SetSelection(Selection(0, 0)); - m_pEditWin->SetAutoScroll(true); -} - -void ODocumentInfoPreview::insertEntry( - OUString const & title, OUString const & value) -{ - if (!m_pEditWin->GetText().isEmpty()) { - m_pEditWin->InsertText("\n\n"); - } - OUString caption(title + ":\n"); - m_pEditWin->InsertText(caption); - m_pEditWin->SetAttrib( - TextAttribFontWeight(WEIGHT_BOLD), m_pEditWin->GetParagraphCount() - 2, - 0, caption.getLength() - 1); - m_pEditWin->InsertText(value); -} - -void ODocumentInfoPreview::insertNonempty(long id, OUString const & value) -{ - if (!value.isEmpty()) { - insertEntry(SvtDocInfoTable_Impl::GetString(id), value); - } -} - -void ODocumentInfoPreview::insertDateTime( - long id, css::util::DateTime const & value) -{ - DateTime aToolsDT( - Date(value.Day, value.Month, value.Year), - tools::Time( - value.Hours, value.Minutes, value.Seconds, value.NanoSeconds)); - if (aToolsDT.IsValidAndGregorian()) { - const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() ); - OUStringBuffer buf(rLocaleWrapper.getDate(aToolsDT)); - buf.append(", "); - buf.append(rLocaleWrapper.getTime(aToolsDT)); - insertEntry(SvtDocInfoTable_Impl::GetString(id), buf.makeStringAndClear()); - } -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx deleted file mode 100644 index acd337e51b82..000000000000 --- a/svtools/source/contnr/templwin.cxx +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you 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 . - */ - -#include <svtools/svtresid.hxx> -#include "templwin.hxx" -#include <templwin.hrc> - -namespace SvtDocInfoTable_Impl -{ - OUString GetString(int nId) - { - for (size_t i = 0; i < SAL_N_ELEMENTS(STRARY_SVT_DOCINFO); ++i) - { - if (STRARY_SVT_DOCINFO[i].second == nId) - return SvtResId(STRARY_SVT_DOCINFO[i].first); - } - - return OUString(); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/templwin.hxx b/svtools/source/contnr/templwin.hxx deleted file mode 100644 index 1a3f435af272..000000000000 --- a/svtools/source/contnr/templwin.hxx +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you 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 . - */ -#pragma once - -#include <rtl/ustring.hxx> - -namespace SvtDocInfoTable_Impl -{ - OUString GetString(int nId); -}; - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |