Kaydet (Commit) 5f0613b8 authored tarafından Rachit Gupta's avatar Rachit Gupta Kaydeden (comit) Jan Holesovsky

Created basic architecture for PersonasDocHandler.

Change-Id: Ic1454344756c48090ebe821799d10dd6ace0264c
üst 3078f0e3
......@@ -157,6 +157,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
cui/source/options/optsave \
cui/source/options/optupdt \
cui/source/options/personalization \
cui/source/options/personasdochandler \
cui/source/options/radiobtnbox \
cui/source/options/sdbcdriverenum \
cui/source/options/securityoptions \
......
......@@ -10,6 +10,7 @@
#include <config_folders.h>
#include "personalization.hxx"
#include "personasdochandler.hxx"
#include <comphelper/processfactory.hxx>
#include <officecfg/Office/Common.hxx>
......@@ -21,18 +22,15 @@
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/system/SystemShellExecute.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
#include <com/sun/star/ui/dialogs/FilePicker.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
#include <com/sun/star/xml/sax/XParser.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
#include "ucbhelper/content.hxx"
using namespace com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
/** Dialog that will allow the user to choose a Persona to use.
......@@ -78,10 +76,28 @@ OUString SelectPersonaDialog::GetPersonaURL() const
IMPL_LINK( SelectPersonaDialog, VisitPersonas, PushButton*, /*pButton*/ )
{
uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShell( com::sun::star::system::SystemShellExecute::create( ::comphelper::getProcessComponentContext() ) );
// uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShell( com::sun::star::system::SystemShellExecute::create( ::comphelper::getProcessComponentContext() ) );
xSystemShell->execute( "https://addons.mozilla.org/firefox/themes/", OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY );
// xSystemShell->execute( "https://addons.mozilla.org/firefox/themes/", OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY );
Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext);
PersonasDocHandler* pHandler = new PersonasDocHandler();
Reference< xml::sax::XDocumentHandler > xDocHandler = pHandler;
uno::Reference< ucb::XSimpleFileAccess3 > xFileAccess( ucb::SimpleFileAccess::create( comphelper::getProcessComponentContext() ), uno::UNO_QUERY );
xParser->setDocumentHandler( xDocHandler );
OUString rURL = "file:////home/rachit/test.xml";
Reference< io::XInputStream > xStream;
try {
xStream = xFileAccess->openFileRead( rURL );
}
catch (...)
{
return false;
}
xml::sax::InputSource aParserInput;
aParserInput.aInputStream = xStream;
xParser->parseStream( aParserInput );
return 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 "personasdochandler.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
// XDocumentHandler
void SAL_CALL
PersonasDocHandler::startDocument()
throw ( xml::sax::SAXException, RuntimeException, std::exception )
{
}
void SAL_CALL
PersonasDocHandler::endDocument()
throw ( xml::sax::SAXException, RuntimeException, std::exception )
{
}
void SAL_CALL
PersonasDocHandler::characters( const OUString & )
throw ( xml::sax::SAXException, RuntimeException, std::exception )
{
}
void SAL_CALL
PersonasDocHandler::ignorableWhitespace( const OUString & )
throw ( xml::sax::SAXException, RuntimeException, std::exception )
{
}
void SAL_CALL
PersonasDocHandler::processingInstruction(
const OUString &, const OUString & )
throw ( xml::sax::SAXException, RuntimeException, std::exception )
{
}
void SAL_CALL
PersonasDocHandler::setDocumentLocator(
const Reference< xml::sax::XLocator >& )
throw ( xml::sax::SAXException, RuntimeException, std::exception )
{
}
void SAL_CALL
PersonasDocHandler::startElement( const OUString& aName,
const Reference< xml::sax::XAttributeList > & xAttribs )
throw ( xml::sax::SAXException,
RuntimeException, std::exception )
{
SAL_DEBUG("startElement: " << aName << "\n");
for (sal_Int16 i = 0; i < xAttribs->getLength(); ++i)
{
SAL_DEBUG("\t\tAttribute Name: " << xAttribs->getNameByIndex(i) << "\tAttribute Value: " << xAttribs->getValueByIndex(i) << "\n");
}
}
void SAL_CALL PersonasDocHandler::endElement( const OUString & aName )
throw ( xml::sax::SAXException, RuntimeException, std::exception )
{
SAL_DEBUG("endElement: " << aName << "\n");
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 <cppuhelper/implbase1.hxx>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <com/sun/star/xml/sax/XParser.hpp>
class PersonasDocHandler : public ::cppu::WeakImplHelper1< css::xml::sax::XDocumentHandler >
{
private:
OUString m_sHeaderURL;
OUString m_sFooterURL;
OUString m_sTextColor;
OUString m_sAccentColor;
public:
PersonasDocHandler(){}
OUString getHeaderURL() { return m_sHeaderURL; }
OUString getFooterURL() { return m_sFooterURL; }
OUString getTextColor() { return m_sTextColor; }
OUString getAccentColor() { return m_sAccentColor; }
// XDocumentHandler
virtual void SAL_CALL startDocument()
throw ( css::xml::sax::SAXException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual void SAL_CALL endDocument()
throw ( css::xml::sax::SAXException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual void SAL_CALL startElement( const OUString& aName,
const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs )
throw ( css::xml::sax::SAXException,
css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual void SAL_CALL endElement( const OUString & aName )
throw ( css::xml::sax::SAXException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual void SAL_CALL characters( const OUString & aChars )
throw ( css::xml::sax::SAXException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual void SAL_CALL ignorableWhitespace( const OUString & aWhitespaces )
throw ( css::xml::sax::SAXException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual void SAL_CALL processingInstruction(
const OUString & aTarget, const OUString & aData )
throw ( css::xml::sax::SAXException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual void SAL_CALL setDocumentLocator(
const css::uno::Reference< css::xml::sax::XLocator >& xLocator )
throw ( css::xml::sax::SAXException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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