summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-03-14 09:47:56 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-03-14 09:47:56 +0100
commit50d648ef3345aac539655d386fb6598121e3efe0 (patch)
treecba98a520d0a41d55458a093abc532e005c9b31e /sfx2
parenta6752da41c7c71a5100c73df055ce76cd2adaa8d (diff)
parent1174a070b2d475470d748913add4989f2e6f0cf3 (diff)
debuglevels: pulled and merged DEV300.m102
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/qa/cppunit/makefile.mk86
-rw-r--r--sfx2/qa/unoapi/makefile.mk48
-rw-r--r--sfx2/source/doc/SfxDocumentMetaData.cxx46
-rwxr-xr-x[-rw-r--r--]sfx2/source/view/viewprn.cxx50
4 files changed, 208 insertions, 22 deletions
diff --git a/sfx2/qa/cppunit/makefile.mk b/sfx2/qa/cppunit/makefile.mk
new file mode 100644
index 0000000000..b53a04ec43
--- /dev/null
+++ b/sfx2/qa/cppunit/makefile.mk
@@ -0,0 +1,86 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
+
+PRJ=../..
+PRJNAME=sfx2
+TARGET=qa_cppunit
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+#building with stlport, but cppunit was not built with stlport
+.IF "$(USE_SYSTEM_STL)"!="YES"
+.IF "$(SYSTEM_CPPUNIT)"=="YES"
+CFLAGSCXX+=-DADAPT_EXT_STL
+.ENDIF
+.ENDIF
+
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+DLLPRE = # no leading "lib" on .so files
+
+# --- Libs ---------------------------------------------------------
+
+SHL1OBJS= \
+ $(SLO)/test_metadatable.obj \
+
+
+SHL1STDLIBS= \
+ $(CPPUNITLIB) \
+ $(SALLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VCLLIB) \
+ $(SFXLIB) \
+
+
+SHL1TARGET= test_metadatable
+SHL1RPATH = NONE
+SHL1IMPLIB= i$(SHL1TARGET)
+# SHL1DEF= $(MISC)/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+# DEF1EXPORTFILE= export.exp
+SHL1VERSIONMAP= version.map
+
+# --- All object files ---------------------------------------------
+
+SLOFILES= \
+ $(SHL1OBJS) \
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+.INCLUDE : _cppunit.mk
+
+.END
diff --git a/sfx2/qa/unoapi/makefile.mk b/sfx2/qa/unoapi/makefile.mk
new file mode 100644
index 0000000000..ea91ba4d1c
--- /dev/null
+++ b/sfx2/qa/unoapi/makefile.mk
@@ -0,0 +1,48 @@
+#*************************************************************************
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#***********************************************************************/
+
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
+
+PRJ = ../..
+PRJNAME = sfx2
+TARGET = qa_unoapi
+
+.IF "$(OOO_JUNIT_JAR)" != ""
+PACKAGE = org/openoffice/sfx2/qa/unoapi
+JAVATESTFILES = Test.java
+JAVAFILES = $(JAVATESTFILES)
+JARFILES = OOoRunner.jar ridl.jar test.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
+.END
+
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
+.INCLUDE: installationtest.mk
+
+ALLTAR : javatest
+
+.END
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 16a9ba4603..3a7f67f8e2 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -1142,7 +1142,6 @@ void SAL_CALL SfxDocumentMetaData::init(
m_isInitialized = false;
m_xDoc = i_xDoc;
- m_xDoc->normalize();
// select nodes for standard meta data stuff
xPath->registerNS(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xlink")),
@@ -1171,26 +1170,49 @@ void SAL_CALL SfxDocumentMetaData::init(
if (!m_xParent.is()) {
// all this create/append stuff may throw DOMException
try {
- css::uno::Reference<css::xml::dom::XElement> xRElem(
- i_xDoc->createElementNS(
+ css::uno::Reference<css::xml::dom::XElement> xRElem;
+ css::uno::Reference<css::xml::dom::XNode> xNode(
+ i_xDoc->getFirstChild());
+ while (xNode.is()) {
+ if (css::xml::dom::NodeType_ELEMENT_NODE ==xNode->getNodeType())
+ {
+ if (xNode->getNamespaceURI().equalsAscii(s_nsODF) &&
+ xNode->getLocalName().equalsAscii("document-meta"))
+ {
+ xRElem.set(xNode, css::uno::UNO_QUERY_THROW);
+ break;
+ }
+ else
+ {
+ OSL_TRACE("SfxDocumentMetaData::init(): "
+ "deleting unexpected root element: %s",
+ ::rtl::OUStringToOString(xNode->getLocalName(),
+ RTL_TEXTENCODING_UTF8).getStr());
+ i_xDoc->removeChild(xNode);
+ xNode = i_xDoc->getFirstChild(); // start over
+ }
+ } else {
+ xNode = xNode->getNextSibling();
+ }
+ }
+ if (!xRElem.is()) {
+ xRElem = i_xDoc->createElementNS(
::rtl::OUString::createFromAscii(s_nsODF),
- ::rtl::OUString::createFromAscii("office:document-meta")));
- css::uno::Reference<css::xml::dom::XNode> xRNode(xRElem,
- css::uno::UNO_QUERY_THROW);
- // NB: the following is a _bad_idea_ with our DOM implementation
- // do _not_ create attributes with xmlns prefix!
-// xRElem->setAttribute(::rtl::OUString::createFromAscii("xmlns:office"),
-// ::rtl::OUString::createFromAscii(s_nsODF));
+ ::rtl::OUString::createFromAscii("office:document-meta"));
+ css::uno::Reference<css::xml::dom::XNode> xRNode(xRElem,
+ css::uno::UNO_QUERY_THROW);
+ i_xDoc->appendChild(xRNode);
+ }
xRElem->setAttributeNS(::rtl::OUString::createFromAscii(s_nsODF),
::rtl::OUString::createFromAscii("office:version"),
::rtl::OUString::createFromAscii("1.0"));
- i_xDoc->appendChild(xRNode);
+ // does not exist, otherwise m_xParent would not be null
css::uno::Reference<css::xml::dom::XNode> xParent (
i_xDoc->createElementNS(
::rtl::OUString::createFromAscii(s_nsODF),
::rtl::OUString::createFromAscii("office:meta")),
css::uno::UNO_QUERY_THROW);
- xRNode->appendChild(xParent);
+ xRElem->appendChild(xParent);
m_xParent = xParent;
} catch (css::xml::dom::DOMException & e) {
css::uno::Any a(e);
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 03dff42234..fc47c6785f 100644..100755
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -191,15 +191,19 @@ SfxPrinterController::~SfxPrinterController()
const Any& SfxPrinterController::getSelectionObject() const
{
+ const beans::PropertyValue* pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintSelectionOnly" ) ) );
+ if( pVal )
+ {
+ sal_Bool bSel = sal_False;
+ pVal->Value >>= bSel;
+ return bSel ? maSelection : maCompleteSelection;
+ }
+
sal_Int32 nChoice = 0;
- sal_Bool bSel = sal_False;
- const beans::PropertyValue* pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ) );
+ pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ) );
if( pVal )
pVal->Value >>= nChoice;
- pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintSelectionOnly" ) ) );
- if( pVal )
- pVal->Value >>= bSel;
- return (nChoice > 1 || bSel) ? maSelection : maCompleteSelection;
+ return (nChoice > 1) ? maSelection : maCompleteSelection;
}
Sequence< beans::PropertyValue > SfxPrinterController::getMergedOptions() const
@@ -307,6 +311,7 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt
{
if ( mpObjectShell )
{
+ bool bCopyJobSetup = false;
mpObjectShell->Broadcast( SfxPrintingHint( nState ) );
switch ( nState )
{
@@ -334,12 +339,29 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt
rBind.Invalidate( SID_PRINTDOC );
rBind.Invalidate( SID_PRINTDOCDIRECT );
rBind.Invalidate( SID_SETUPPRINTER );
+ bCopyJobSetup = true;
break;
}
default:
break;
}
+
+ if( bCopyJobSetup && mpViewShell )
+ {
+ SfxPrinter* pDocPrt = mpViewShell->GetPrinter(sal_False);
+ if( pDocPrt )
+ {
+ if( pDocPrt->GetName() == getPrinter()->GetName() )
+ pDocPrt->SetJobSetup( getPrinter()->GetJobSetup() );
+ else
+ {
+ SfxPrinter* pNewPrt = new SfxPrinter( pDocPrt->GetOptions().Clone(), getPrinter()->GetName() );
+ pNewPrt->SetJobSetup( getPrinter()->GetJobSetup() );
+ mpViewShell->SetPrinter( pNewPrt, SFX_PRINTER_PRINTER | SFX_PRINTER_JOBSETUP );
+ }
+ }
+ }
if ( m_bNeedsChange )
mpObjectShell->EnableSetModified( m_bOrigStatus );
@@ -704,10 +726,18 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
}
}
}
- sal_Int32 nLen = aProps.getLength();
- aProps.realloc( nLen + 1 );
- aProps[nLen].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintSelectionOnly" ) );
- aProps[nLen].Value = makeAny( bSelection );
+ // HACK: writer sets the SID_SELECTION item when printing directly and expects
+ // to get only the selection document in that case (see getSelectionObject)
+ // however it also reacts to the PrintContent property. We need this distinction here, too,
+ // else one of the combinations print / print direct and selection / all will not work.
+ // it would be better if writer handled this internally
+ if( nId == SID_PRINTDOCDIRECT )
+ {
+ sal_Int32 nLen = aProps.getLength();
+ aProps.realloc( nLen + 1 );
+ aProps[nLen].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintSelectionOnly" ) );
+ aProps[nLen].Value = makeAny( bSelection );
+ }
ExecPrint( aProps, bIsAPI, (nId == SID_PRINTDOCDIRECT) );