Kaydet (Commit) 9db55120 authored tarafından Miklos Vajna's avatar Miklos Vajna

sc: make metadata available in copy result

Calc had the same problem as Writer: metadata is part of the doc shell,
but the clipboard document has no doc shell. So need to store this info
in ScDocument in some way in the clipboard case.

10:45 <@moggi> vmiklos: I would most likely add a ScClipOptions similar to ScDocOptions and only populate it in the clip document

Change-Id: I4ad01faa55cfb6fb58213d67003c8c0f9849800d
üst 7f1d68a7
/* -*- 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/.
*/
#ifndef INCLUDED_SC_INC_CLIPOPTIONS_HXX
#define INCLUDED_SC_INC_CLIPOPTIONS_HXX
#include <com/sun/star/document/XDocumentProperties.hpp>
/// Stores options which are only relevant for clipboard documents.
class SC_DLLPUBLIC ScClipOptions
{
public:
/// Document properties.
css::uno::Reference<css::document::XDocumentProperties> m_xDocumentProperties;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -117,6 +117,7 @@ class ScBroadcastAreaSlotMachine;
class ScChangeViewSettings;
class ScChartCollection;
class ScChartListenerCollection;
class ScClipOptions;
class ScConditionalFormat;
class ScConditionalFormatList;
class ScDBCollection;
......@@ -351,6 +352,7 @@ private:
ScViewOptions* pViewOptions; // view options
ScDocOptions* pDocOptions; // document options
ScExtDocOptions* pExtDocOptions; // for import etc.
std::unique_ptr<ScClipOptions> mpClipOptions; // clipboard options
ScConsolidateParam* pConsolidateDlgData;
ScRecursionHelper* pRecursionHelper; // information for recursive and iterative cell formulas
......@@ -506,6 +508,9 @@ public:
ScExtDocOptions* GetExtDocOptions() { return pExtDocOptions; }
SC_DLLPUBLIC void SetExtDocOptions( ScExtDocOptions* pNewOptions );
ScClipOptions* GetClipOptions() { return mpClipOptions.get(); }
void SetClipOptions(const ScClipOptions& rClipOptions);
SC_DLLPUBLIC void GetLanguage( LanguageType& rLatin, LanguageType& rCjk, LanguageType& rCtl ) const;
void SetLanguage( LanguageType eLatin, LanguageType eCjk, LanguageType eCtl );
......
......@@ -99,6 +99,7 @@
#include "interpre.hxx"
#include <tokenstringcontext.hxx>
#include "docsh.hxx"
#include "clipoptions.hxx"
#include <listenercontext.hxx>
using namespace com::sun::star;
......
......@@ -41,6 +41,7 @@
#include "chartlock.hxx"
#include "refupdat.hxx"
#include "docoptio.hxx"
#include "clipoptions.hxx"
#include "viewopti.hxx"
#include "scextopt.hxx"
#include "brdcst.hxx"
......@@ -75,6 +76,7 @@
#include "globalnames.hxx"
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/lok.hxx>
#include <o3tl/make_unique.hxx>
#include <memory>
using namespace com::sun::star;
......@@ -1953,6 +1955,11 @@ void ScDocument::SetExtDocOptions( ScExtDocOptions* pNewOptions )
pExtDocOptions = pNewOptions;
}
void ScDocument::SetClipOptions(const ScClipOptions& rClipOptions)
{
mpClipOptions = o3tl::make_unique<ScClipOptions>(rClipOptions);
}
void ScDocument::DoMergeContents( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
SCCOL nEndCol, SCROW nEndRow )
{
......
......@@ -66,8 +66,10 @@
#include "undodat.hxx"
#include "drawview.hxx"
#include "cliputil.hxx"
#include "clipoptions.hxx"
#include <gridwin.hxx>
#include <memory>
#include <com/sun/star/util/XCloneable.hpp>
using namespace com::sun::star;
......@@ -225,6 +227,16 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
// and lose the 'if' above
aClipParam.setSourceDocID( pDoc->GetDocumentID() );
if (SfxObjectShell* pObjectShell = pDoc->GetDocumentShell())
{
// Copy document properties from pObjectShell to pClipDoc (to its clip options, as it has no object shell).
uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(pObjectShell->GetModel(), uno::UNO_QUERY);
uno::Reference<util::XCloneable> xCloneable(xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY);
ScClipOptions aOptions;
aOptions.m_xDocumentProperties.set(xCloneable->createClone(), uno::UNO_QUERY);
pClipDoc->SetClipOptions(aOptions);
}
pDoc->CopyToClip( aClipParam, pClipDoc, &rMark, false, false, bIncludeObjects, true, bUseRangeForVBA );
if ( !bUseRangeForVBA && pDoc && pClipDoc )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment